<?php

namespace App\Http\Controllers\Api;

use App\Models\Area;
use Illuminate\Http\Request;

class AreasController extends BaseController
{
    // 获取省市区
    public function index(Request $request, Area $area)
    {
        $type = intval($request->input('type',1));
        $pid = intval($request->input('pid',0));


        $areas = Area::select('id','name','pid','type')->where('type',$type)->where('pid',$pid)->get();
        return $this->res([
            'data' => $areas
        ]);
    }
}
